<div id="maintable">
 
	<% if current_user.is_admin?%>
		<span class="button">
			<%= link_to image_tag("b_add_new_user.gif"), :action => 'new'%>
		</span>
	<%end%>
		
		
	<% if @sites%>
		<span class="title_one"><%= Role.description_plural(Site) %></span>
		<% title_row=[_("Country"),_("Site"),_("Name"),_("Email"),_("Phone"),_("Last Login")] %>
		<table class="ccuserstable" cellpadding="0" cellspacing="0">
		    <tr>
		        <% title_row.each do |title| %>
					<th class="col1"><%=title %></th>
		        <% end %>
				<% if current_user.is_admin? %>
		    		<th class="col1"><%= _('Actions') %></th>
				<% end %>
		    </tr>
			<% @sites.each do |array_row| %>
				<% key=array_row[0] %>
				<% rows=array_row[1] %>
				<tr><td></td></tr>
				<tr>
					<th colspan="7" class="col1"><%= _(key)%></th>
				</tr>
				<% rows.each do |row| %>
					<tr>
						<td class="col1"><%= _(row[0])%></td>
			            <td class="col2"><%=row[1]%></td>
			        	<td class="col3">
							<% if current_user.is_admin? %>
				            	<%= link_to row[2], :action => 'edit', :id => row[7]  %> 
							<% else %>
								<%=row[2]%>
				            <% end %>
							<%= image_tag("circ_r.gif", :title => "You share some role with this user") if row[6]  %>
						</td>
						<td class="col4"><a href="mailto:<%=row[3]%>"><%=row[3]%></a></td>
						<td class="col5"><%=row[4]%></td>
			            <td class="col6"><%=row[5] %></td>
						<% if current_user.is_admin? %>
			            	<td class="col7"><%= link_to _('edit'), :action => 'edit', :id => row[7]  %>
							<% if row[8] %>
						 		- <%= link_to _('delete'), :action => 'delete', :id => row[7]  %> </td>
							<% end %>
						<% end %>
		       		 </tr>
				<%end%>	
			<%end%>			
		</table>
	<%end%>		
	
	
	<% if @countries%>
		<span class="title_one"><%= Role.description_plural(Country) %></span>
		<% title_row=[_("Country"),_("City"),_("Authorized User Name"),_("Email"),_("Phone"),_("Last Login")] %>
		<table class="ccuserstable" cellpadding="0" cellspacing="0">
		    <tr>
		        <% title_row.each do |title| %>
					<th class="col1"><%=title %></th>
		        <% end %>
				<% if current_user.is_admin? %>
		    		<th class="col1"><%= _('Actions') %></th>
				<% end %>
		    </tr>
			<% @countries.each do |row| %>
				<tr>
					<td class="col1"><%=_(row[0])%></td>
		            <td class="col2"><%=row[1]%></td>
		        	<td class="col3">
						<% if current_user.is_admin? %>
			            	<%= link_to row[2], :action => 'edit', :id => row[7]  %> 
						<% else %>
							<%=row[2]%>
			            <% end %>
						<%= image_tag("circ_r.gif", :title => "You share some role with this user") if row[6]  %>
					</td>
					<td class="col4"><a href="mailto:<%=row[3]%>"><%=row[3]%></a></td>
					<td class="col5"><%=row[4]%></td>
		            <td class="col6"><%=row[5] %></td>
					<% if current_user.is_admin? %>
		            	<td class="col7"><%= link_to _('edit'), :action => 'edit', :id => row[7]  %>
						<% if row[8] %>
						 - <%= link_to _('delete'), :action => 'delete', :id => row[7]  %> </td>
						<% end %>
					<% end %>
		        </tr>
			<% end %>			
		</table>
	<%end%>
	
	
	
	
	<% if @strategies%>
		<span class="title_one"><%= Role.description_plural(Strategy) %></span>
		<%title_row=[_("Country"), _("City"), _("Authorized User Name"), _("Email"), _("Strategy"), _("Phone"), _("Last Login")]  %>
		<table class="ccuserstable" cellpadding="0" cellspacing="0">
		    <tr>
		        <% title_row.each do |title| %>
					<th class="col1"><%=title %></th>
		        <% end %>
				<% if current_user.is_admin? %>
		    		<th class="col1"><%= _('Actions') %></th>
				<% end %>
		    </tr>
			<% @strategies.each do |row| %>
				<tr>
					<td class="col1"><%=_(row[0])%></td>
		            <td class="col2"><%=row[1]%></td>
		        	<td class="col3">
						<% if current_user.is_admin? %>
			            	<%= link_to row[2], :action => 'edit', :id => row[8]  %> 
						<% else %>
							<%=row[2]%>
			            <% end %>
						<%= image_tag("circ_r.gif", :title => "You share some role with this user") if row[7]  %>
					</td>
					<td class="col4"><a href="mailto:<%=row[3]%>"><%=row[3]%></a></td>
					<td class="col5"><%=row[4]%></td>
					<td class="col6"><%=row[5] %></td>
		            <td class="col7"><%=row[6] %></td>
					<% if current_user.is_admin? %>
		            	<td class="col8"><%= link_to _('edit'), :action => 'edit', :id => row[8]  %>
						<% if row[9] %>
						 - <%= link_to _('delete'), :action => 'delete', :id => row[8]  %> </td>
						<% end %>
					<% end %>
		        </tr>
			<% end %>			
		</table>
	<%end%>
	<% if @admins %>
		<span class="title_one"><%= _('Administrators') %></span>
		<% title_row=[_("Country"), _("City"), _("Display Name"), _("Email"), _("Phone"), _("Last Login")] %>
		<table class="ccuserstable" cellpadding="0" cellspacing="0">
		    <tr>
		        <% title_row.each do |title| %>
					<th class="col1"><%=title %></th>
		        <% end %>
				<% if current_user.is_admin? %>
		    		<th class="col1"><%= _('Actions') %></th>
				<% end %>
		    </tr>
			<% @admins.each do |row| %>
				<tr>
					<td class="col1"><%=_(row[0])%></td>
		            <td class="col2"><%=row[1]%></td>
		        	<td class="col3">
						<% if current_user.is_admin? %>
			            	<%= link_to row[2], :action => 'edit', :id => row[7]  %> 
						<% else %>
							<%=row[2]%>
			            <% end %>
						<%= image_tag("circ_r.gif", :title => "You share some role with this user") if row[6]  %>
					</td>
					<td class="col4"><a href="mailto:<%=row[3]%>"><%=row[3]%></a></td>
					<td class="col5"><%=row[4]%></td>
					<td class="col6"><%=row[5] %></td>
					<% if current_user.is_admin? %>
		            	<td class="col7"><%= link_to _('edit'), :action => 'edit', :id => row[7]  %>
					<% end %>
		        </tr>
			<% end %>			
		</table>
		
	<%end%>
	<% content_for :footer do %>
		<% if current_user.is_admin? %>
			<% if @allow_login %>
				<%= link_to _('show inactive users'), { :action => "show_users_blocked"}, {:style => "margin-left : 1em;"} %>
			<% else %>
				<%= link_to _('show active users'),{ :action => "index"}, {:style => "margin-left : 1em;"} %>
			<% end %>
		<% end %>
	<% end %>
</div>